[QUIZ] Test your understanding of SQL - Part 7

Part 7 of the SQL quiz goes into the SQL practice exercises that follow the previous period.

  1. Question 1: What is the result of the following SQL statement?
     SELECT COUNT(DISTINCT STUDENT_ID) FROM EXAM_RESULTS; 
    1. 3
    2. 4
    3. 5
    4. 6
  2. Question 2: Which SQL statement is used to calculate the average test score for the 1st test?
    1. SELECT AVG (DIEM_KT) FROM KETQUA_KIEMTRA;
    2. SELECT AVG (DIEM_KT) FROM KETQUA_KIEMTRA WHERE ID_BAIKT = 1;
    3. SELECT AVG (DIEM_KT) FROM KETQUA_KIEMTRA GROUP BY ID_BAIKT;
    4. SELECT COUNT (DIEM_KT) FROM KETQUA_KIEMTRA WHERE ID_BAIKT = 1;
  3. Question 3: Which SQL statement is used to calculate each test how many students have done?
    1. SELECT COUNT (DISTINCT ID_SV) FROM KETQUA_KIEMTRA GROUP BY ID_BAIKT;
    2. SELECT ID_BAIKT, MAX (ID_SV) FROM KETQUA_KIEMTRA GROUP BY ID_BAIKT;
    3. SELECT ID_BAIKT, COUNT (DISTINCT ID_SV) FROM KETQUA_KIEMTRA GROUP BY ID_BAIKT;
    4. SELECT ID_BAIKT, MIN (ID_SV) FROM KETQUA_KIEMTRA GROUP BY ID_BAIKT;
  4. Question 4: Which SQL statement is used to print out the record of all students who start with 'L'?
    1. SELECT * FROM KETQUA_KIEMTRA WHERE HO_SV LIKE 'L%';
    2. SELECT * FROM KETQUA_KIEMTRA WHERE HO_SV LIKE 'L';
    3. SELECT * FROM KETQUA_KIEMTRA WHERE HO_SV = 'L';
    4. SELECT * FROM KETQUA_KIEMTRA WHERE HO_SV <> 'L';
  5. Question 5: What is the result of the following SQL statement?
     SELECT MAX(DIEM_KT) FROM KETQUA_KIEMTRA WHERE ID_BAIKT = 1 AND HO_SV LIKE '%U%'; 
    1. 95
    2. 85
    3. 100
    4. 78
  6. Question 6: Which SQL statement is used to print out the records of all students whose first or last name ends with 'N'?
    1. SELECT * FROM KETQUA_KIEMTRA WHERE TEN_SV LIKE '% N' OR HO_SV LIKE '% N';
    2. SELECT * FROM KETQUA_KIEMTRA WHERE TEN_SV LIKE 'N' OR HO_SV LIKE 'N';
    3. SELECT * FROM KETQUA_KIEMTRA WHERE TEN_SV LIKE 'N%' OR HO_SV LIKE 'N%';
    4. SELECT * FROM KETQUA_KIEMTRA WHERE TEN_SV LIKE '% N%' OR HO_SV LIKE '% N%';
  7. Question 7: Which SQL statement is used to find the names of all students who score higher than 90 on the 2nd test?
    1. SELECT TEN_SV, HO_SV FROM KETQUA_KIEMTRA WHERE ID_BAIKT = 2 OR DIEM_KT> 90;
    2. SELECT TEN_SV, HO_SV FROM KETQUA_KIEMTRA WHERE ID_BAIKT = 2 AND DIEM_KT> 90;
    3. SELECT TEN_SV, HO_SV FROM KETQUA_KIEMTRA WHERE DIEM_KT> 90;
    4. SELECT TEN_SV, HO_SV FROM KETQUA_KIEMTRA WHERE ID_BAIKT = 2 HAVING DIEM_KT> 90;
  8. Question 8: Which SQL statement is used to find the names of all students who scored a total of 2 tests higher than 180?
    1. SELECT TEN_SV, HO_SV, SUM (DIEM_KT) FROM KETQUA_KIEMTRA GROUP BY TEN_SV, HO_SV;
    2. SELECT TEN_SV, HO_SV, SUM (DIEM_KT) FROM KETQUA_KIEMTRA HAVING SUM (DIEM_KT)> 180;
    3. SELECT TEN_SV, HO_SV, SUM (DIEM_KT) FROM KETQUA_KIEMTRA GROUP BY TEN_SV, HO_SV HAVING SUM (DIEM_KT)> 180;
    4. SELECT TEN_SV, HO_SV, SUM (DIEM_KT) FROM KETQUA_KIEMTRA WHERE DIEM_KT> 180 GROUP BY TEN_SV, HO_SV;
  9. Question 9: How many records have the following SQL statement generated?
     SELECT * FROM KETQUA_KIEMTRA WHERE HO_SV LIKE '%U%' AND DIEM_KT > 75; 
    1. 3
    2. 4
    3. 5
    4. There is no answer
  10. Question 10: How many records do the following SQL statements return?
     SELECT * FROM KETQUA_KIEMTRA WHERE ID_SV <= 12 AND DIEM > 85; 
    1. 5
    2. 4
    3. 3
    4. 2
Update 24 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile